<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
    <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
    <TITLE></TITLE>
    <STYLE TYPE="text/css">
    <!--
        @page { size: landscape; margin: 2cm }
        P { margin-bottom: 0.21cm }
        TD P { margin-bottom: 0cm }
        TH P { margin-bottom: 0cm }
        A:link { so-language: zxx }
    -->
    </STYLE>
</HEAD>
<BODY LANG="it-IT" DIR="LTR">
<P>Prospetto risultante per la statistica :{{pageData["ricerca_stringa"]}}</P>


<P>Cliente:</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
    <COL WIDTH=37*>
    <COL WIDTH=37*>
    <COL WIDTH=37*>
    <COL WIDTH=37*>
    <COL WIDTH=37*>
    <COL WIDTH=37*>
    <COL WIDTH=37*>
    <THEAD>
        <TR VALIGN=TOP>
            <TH WIDTH=18%>
                <P>Ragione Sociale</P>
            </TH>
            <TH WIDTH=14%>
                <P>Tot imponibile </P>
            </TH>
            <TH WIDTH=14%>
                <P>Tot NON base imponibile</P>
            </TH>
            <TH WIDTH=14%>
                <P>Tot iva acquistato</P>
            </TH>
            <TH WIDTH=14%>
                <P>Tot acquistato</P>
            </TH>
            <TH WIDTH=14%>
                <P>Valore acq. medio</P>
            </TH>
            <TH WIDTH=10%>
                <P>Numero acquisti</P>
            </TH>
        </TR>
    </THEAD>
    <TBODY>
    {% for k,v in pageData["diz"].iteritems() %}
    <!--k = il dao cliente-->
    <!--v[0] = sono i totali documento-->
    <!--v[1] = numero totale dei documenti-->
    <!--v[2] = BOH-->
        <TR VALIGN=TOP>
            <TD WIDTH=18%>
                <P>{{k.ragione_sociale}}</P>
            </TD>
            <TD WIDTH=14%>
                <P>{{utils.mNLC(v[0]["totale_imponibile_scontato"],2)}}</P>
            </TD>
                <TD WIDTH=14%>
                <P>{{utils.mNLC(v[0]["totale_non_base_imponibile"],2)}}</P>
            </TD>
            <TD WIDTH=14%>
                <P>{{utils.mNLC(v[0]["totale_imposta_scontata"],2)}}</P>
            </TD>
            <TD WIDTH=14%>
                <P><b>{{utils.mNLC(v[0]["totale_scontato"],2)}}</b></P>
            </TD>
            <TD WIDTH=14%>
                {%if v[1] > 0 %}
                <P>{{utils.mNLC(v[0]["totale_scontato"]/v[1] or 1,2)}}</P>
                {% else %}
                 <P> </P>
                 {% endif %}
            </TD>
            <TD WIDTH=10%>
                <P><b>{{v[0]["numero_documenti"]}}</b> di {{v[1] }}</P>
            </TD>
        </TR >
        {% for k in v[2] %}
                <TR VALIGN=TOP style="background:#ddeedd">
            <TD WIDTH=18%>
                <P>{{k}}</P>
            </TD>
            <TD WIDTH=14%>
                <P>{{utils.mNLC(v[2][k][0],2)}}</P>
            </TD>
            <TD WIDTH=14%>
                <P></P>
                 </TD>
            <TD WIDTH=14%>
                <P></P>
            </TD>
            <TD WIDTH=14%>
                <P></P>
            </TD>
            <TD WIDTH=14%>
                 <P>PZ:{{utils.mN(v[2][k][1],1)}}</P>
            </TD>
            <TD WIDTH=10%>
                {%if v[0]["totale_imponibile_scontato"] > 0 %}
                    <P>{{utils.mN(v[2][k][0]*100/v[0]["totale_imponibile_scontato"],1)}}%</P>
                {% elif v[0]["totale_non_base_imponibile"] > 0 %}
                    <P>{{utils.mN(v[2][k][0]*100/v[0]["totale_non_base_imponibile"],1)}}%</P>
                {% else %}
                    <P> </P>
                 {% endif %}
            </TD>
        </TR>
        {% endfor %}
                {% for k in v[3] %}
                <TR VALIGN=TOP style="background:#d9edf7">
            <TD WIDTH=18%>
                <P>{{k}}</P>
            </TD>
            <TD WIDTH=14%>
                <P>{{utils.mNLC(v[3][k][0],2)}}</P>
            </TD>
            <TD WIDTH=14%>
                <P></P>
            </TD>
                        <TD WIDTH=14%>
                <P></P>
                 </TD>
            <TD WIDTH=14%>
                <P></P>
            </TD>
            <TD WIDTH=14%>
                 <P>PZ:{{utils.mN(v[3][k][1],1)}}</P>
            </TD>
            <TD WIDTH=10%>
               {%if v[0]["totale_imponibile_scontato"] > 0 %}
                    <P>{{utils.mN(v[3][k][0]*100/v[0]["totale_imponibile_scontato"],1)}}%</P>
                {% elif v[0]["totale_non_base_imponibile"] > 0 %}
                <P>{{utils.mN(v[3][k][0]*100/v[0]["totale_non_base_imponibile"],1)}}%</P>
                {% else %}
                 <P> </P>
                 {% endif %}
            </TD>
        </TR>
        {% endfor %}
    {% endfor %}
        <tr>
        <td><b>TOTALI</b></td><td>{{utils.mNLC(pageData["totali"][1],2)}}</td><td></td><td>{{utils.mNLC(pageData["totali"][2],2)}}</td><td>{{utils.mNLC(pageData["totali"][0],2)}}</td><td></td><td>{{pageData["totali"][3]}}</td>
    </tr>
    </TBODY>
</TABLE>
</BODY>
</HTML>
